<?php

/**
 * Contains a class to define a Session object to describe a user's session.
 *
 * PHP Version 5
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @author   Mike Pennisi <mpennisi@andrew.cmu.edu>
 * @author   Aaron Ryden <aryden@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 */
 
/**
 * A class to define a Session object to describe a user's session.
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @author   Mike Pennisi <mpennisi@andrew.cmu.edu>
 * @author   Aaron Ryden <aryden@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 */

class Session
{
    /**
     * The session ID.
     *
     * @access public
     * @var string    Corresponds to sessions.id
     */
    public $id;
    
    /**
     * The userId that this session belongs to.
     *
     * @access public
     * @var int       Corresponds to sessions.userid, FK on users.id
     */
    public $userId;
    
    /**
     * The IP address of the user.
     *
     * @access public
     * @var string    Corresponds to sessions.ip
     */
    public $ip;
    
    /**
     * A UNIX timestamp containing the date and time of last activity.
     *
     * @access public
     * @var int       Corresponds to sessions.lastactive
     */
    public $lastActive;

    /**
     * Constructor function.  Populates variables based on parameters.
     *
     * @param string $id         The session's ID.
     * @param int    $userId     The user's ID.
     * @param string $ip         The user's IP address.
     * @param int    $lastActive The date and time of last activity.
     *
     * @access public
     * @return null
     */
    public function __construct($id = null, $userId = null, $ip = null,
        $lastActive = null
    ) {
        $this->id         = $id;
        $this->userId     = $userId;
        $this->ip         = $ip;
        $this->lastActive = $lastActive;
    }
}

?>